home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl150l.zip / STARTUP / ENVSET.C < prev    next >
C/C++ Source or Header  |  1997-02-28  |  525b  |  28 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include <libp.h>
  6.  
  7. char **_env_arr;
  8.  
  9. #pragma startup envset 19
  10.  
  11. void envset(void)
  12. {
  13.     int count = _ll_getenv(0,0),i;
  14.     if (count) {
  15.         _env_arr  = malloc(sizeof(char *)*(count+1));
  16.       for (i=1; i<=count; i++) {
  17.             char buf[1024];
  18.             _ll_getenv(buf,i);
  19.           _env_arr[i-1] = malloc(strlen(buf)+1);
  20.           strcpy(_env_arr[i-1],buf);
  21.         }
  22.         _env_arr[count] = 0;
  23.     }
  24.     else {
  25.         _env_arr = malloc(sizeof(char *));
  26.         _env_arr[0] = 0;
  27.     }
  28. }